/*  Copyright 2010 Daniel Brasil Magnani
 *  Created on: Dec 20, 2010
 *      Author: daniel */

#include "constructive.h"
#include <gtest/gtest.h>

class ConstructiveTest : public testing::Test {
  protected:
    char temp_string_[256];
    int temp_int_;
    Instance i1_;
    Instance i2_;

    virtual void SetUp() {
      strcpy(temp_string_, "028_ch1_EP_ENP_RAF_S22_J2");
      i1_.Init(temp_string_);
    }
};

TEST_F(ConstructiveTest, ReadPaintInput) {
  EXPECT_GT(i1_.get_paint_batch_limit(), 0);
  EXPECT_LT(i1_.get_paint_batch_limit(), 1500);
}

TEST_F(ConstructiveTest, ReadConstraints) {
  std::vector<Constraint> c1;
  c1 = i1_.get_constraint_list();
  EXPECT_GT(c1.size(), 0);
  EXPECT_LT(c1.size(), 500);

  for (int i = 0;i < c1.size();i++) {
    EXPECT_GT(c1[i].n, 0);
    EXPECT_GT(c1[i].p, 0);
    EXPECT_GT(c1[i].p, c1[i].n);
    EXPECT_LT(c1[i].priority, 2);
    EXPECT_GT(c1[i].priority, -1);
  }
}

TEST_F(ConstructiveTest, ReadVehicles) {
  std::vector<Car> yesterday;
  std::vector<Car> today;
  yesterday = i1_.get_yesterday_cars();
  today = i1_.get_today_cars();
  EXPECT_GT(yesterday.size(), 0);
  EXPECT_GT(today.size(), 0);

  for (int i = 0;i < yesterday.size();i++) {
    EXPECT_GT(yesterday[i].color, 0);
  }

  for (int i = 0;i < today.size();i++) {
    EXPECT_GT(today[i].color, 0);
  }
}
